package itheima.d09;

public class Test {
    public static void main(String[] args) {
        Animal dog= new Animal("旺财") {
            @Override
            public void eat() {
                System.out.println("啃骨头");

            }
        };
        bread(dog);
        bread(new Animal("小花") {
            @Override
            public void eat() {
                System.out.println("吃鱼");
            }
        });
        Swiming pig =new Swiming() {
            @Override
            public void swim() {

            }
        };
        swim( pig);

        swim(new Swiming() {
            @Override
            public void swim() {
                System.out.println("小ji游");

            }
        });

        swim(new Swiming() {
            @Override
            public void swim() {
                System.out.println("小jy游");

            }
        });


    }
    public static void bread(Animal a){
        a.eat();
    }
    public static void swim(Swiming swiming){
        System.out.println("开始游");
        swiming.swim();
        System.out.println("游结束");
    }




    };





